import { defineStore } from 'pinia'
// import { useUserStore } from './user'
import { getSocietyRule, getUserRule, getVipRule, getPrivateRule } from '@/common/http/module/common.js'

export const useCommonStore = defineStore('common', {
  state: () => ({
    societyRule: '',
    userRule: '',
    vipRule: '',
    privateRule: '',
  }),
  actions: {
    async init() {
      // if (!useUserStore().isLogin) return
      const { data: userRule } = await getUserRule()
      this.userRule = userRule
      const { data: societyRule } = await getSocietyRule()
      this.societyRule = societyRule
      const { data: vipRule } = await getVipRule()
      this.vipRule = vipRule
      const { data: privateRule } = await getPrivateRule()
      this.privateRule = privateRule
    }
  }
})